"""

安装 PyExecJS
pip install PyExecJS

安装  node.js
https://nodejs.org/en
"""

import execjs

# js = """
# function add(a, b){
#     return a + b;
# }
# """
#
# cxt = execjs.compile(js)
#
# res = cxt.call("add", 1, 2)
# print(res)

with open("rsa.js", "r", encoding="utf-8") as fp:
    js = fp.read()


cxt = execjs.compile(js)
e = "010001"
f = "00e0b509f6259df8642dbc35662901477df22677ec152b5ff68ace615bb7b725152b3ab17a876aea8a5aa76d2e417629ec4ee341f56135fccf695280104e0312ecbda92557c93870114af6c9d05c4f7f0c3685b7a46bee255932575cce10b424d813cfe4875d3e82047b97ddef52741d546b8e289dc6935b3ece0462db0a22b8e7"
res = cxt.call("rsa_encrypt", "J9LtmDNAD8qvqn2J", e, f)
print(res)

